package com.zmj.controller;


import com.zmj.common.Res;
import com.zmj.entity.User;
import com.zmj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/user")
public class UserController {
@Autowired
private UserService userService;
    /**
     * 登录接口
     */
    @PostMapping("/login")
    public Res login(@RequestBody User user){
        User loginUser = userService.login(user);
        if (loginUser == null){
            return  new Res(0,"登陆失败");
        }else {
            return  new Res(1,"登录失败",loginUser);
        }
    }
/**
 * 注册接口
 */
    @PostMapping("/register")
    public Res register(@RequestBody @Validated(UserRegister.class)User user){
       User registerUser = userService.regi
    }


}
